package cn.iocoder.yudao.module.alipay.dal.mysql.infoproduction;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.infoproduction.InfoProductionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.admin.infoproduction.vo.*;

/**
 * 作品 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InfoProductionMapper extends BaseMapperX<InfoProductionDO> {

    default PageResult<InfoProductionDO> selectPage(InfoProductionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoProductionDO>()
                .likeIfPresent(InfoProductionDO::getProductionName, reqVO.getProductionName())
                .eqIfPresent(InfoProductionDO::getProductionDescribe, reqVO.getProductionDescribe())
                .eqIfPresent(InfoProductionDO::getDisplayImage, reqVO.getDisplayImage())
                .eqIfPresent(InfoProductionDO::getSort, reqVO.getSort())
                .eqIfPresent(InfoProductionDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(InfoProductionDO::getLookQuantity, reqVO.getLookQuantity())
                .betweenIfPresent(InfoProductionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoProductionDO::getId));
    }

    default List<InfoProductionDO> selectList(InfoProductionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InfoProductionDO>()
                .likeIfPresent(InfoProductionDO::getProductionName, reqVO.getProductionName())
                .eqIfPresent(InfoProductionDO::getProductionDescribe, reqVO.getProductionDescribe())
                .eqIfPresent(InfoProductionDO::getDisplayImage, reqVO.getDisplayImage())
                .eqIfPresent(InfoProductionDO::getSort, reqVO.getSort())
                .eqIfPresent(InfoProductionDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(InfoProductionDO::getLookQuantity, reqVO.getLookQuantity())
                .betweenIfPresent(InfoProductionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoProductionDO::getId));
    }

    default List<InfoProductionDO> getListByTypeId(String typeId){
        return selectList(new LambdaQueryWrapperX<InfoProductionDO>()
                .eqIfPresent(InfoProductionDO::getTypeId,typeId));
    };
}
